package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.MatType;
import com.indusfo.spc.service.MatTypeService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author louk
 * @description 物料类别接口
 * @date 2019/11/19 9:40
 */
@Controller
@RequestMapping("/service/matType")
public class MatTypeController {

    /**
     * 注入service
     */
    @Resource
    MatTypeService matTypeService;

    /**
     * 新增
     * @param mtypeXO
     * @return
     */
    @RequestMapping(value="insertMatType")
    @ResponseBody
    public JSONObject insertMatType(MatType mtypeXO){
        JSONObject json = matTypeService.insertMatType(mtypeXO) ;
        return json;

    }

    /**
     * 删除
     * @param ids
     * @param dataState
     * @return
     */
    @RequestMapping(value="defineMatType")
    @ResponseBody
    public JSONObject defineMatType(Integer[] ids,Integer   dataState){
        JSONObject json = matTypeService.deleteMtypeXO(ids,dataState);
        return json;

    }

    /**
     * 修改
     * @param mtypeXO
     * @return
     */
    @RequestMapping(value="updateMatType")
    @ResponseBody
    public JSONObject updateMatType(MatType mtypeXO){
        JSONObject json = matTypeService.updateMatType(mtypeXO) ;
        return json;

    }

    /**
     * 查询
     * @param mtypeXO
     * @return
     */
    @RequestMapping(value="queryMatType")
    @ResponseBody
    public JSONObject queryMatType(MatType mtypeXO){
        JSONObject json = matTypeService.listMtypeXO(mtypeXO);
        return json;
    }


    /**
     * 树
     * @param mtypeXO
     * @return
     */
    @RequestMapping(value="treeMatType")
    @ResponseBody
    public JSONObject treeMatType(MatType mtypeXO){
        JSONObject json = matTypeService.treeMtypeXO(mtypeXO);
        return json;

    }
}
